package common;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;


/**
 * file io manager
 * @author jin_woo_lee
 *
 */
public class FileIoManager {

	private Scanner scanner;
	private PrintWriter pw;
	
	public FileIoManager(String inputFilePath, String outputFilePath) {
		File inputFile = new File(inputFilePath);
		File outputFile = new File(outputFilePath);
		
		try {
			scanner = new Scanner(inputFile);
			pw = new PrintWriter(outputFile);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	//입력파일로부터 다음 내역을 읽는다.
	public String next() {
		if(scanner.hasNext())
			return scanner.next();
		else
			return null;
	}

	//출력파일에 내용 기록
	public void write(String string) {
		pw.println(string);
	}

	//출력종료
	public void writeEnd() {
		pw.close();
	}
	

}